UNIX QUICK REFERENCE GUIDE

Directory Manipulation Commands

lsList filenames only.
ls -lLong format including permissions, owner, file size, date, and filename.
ls -alSame as -l option but shows hidden ('dot') files also.
cdReturn to home (login) directory.
cd pathChange to directory specified by path
cd ~/mail Change to your mail folder directory.
cd ..Return to the directory on the next level up.
pwdDisplay what directory you are currently in.

File Manipulation Commands

cp source destination Make a copy of the source file giving it the name of destination. destination can be another directory.
mv oldname newname Rename a file from oldname to newname.
mv oldplace newplace Move a file from oldplace to newplace.newplace can be another directory.
more file Display the contents of the specified file (<SPACEBAR> to go forward, <Q>to quit).
pico file Edit a file using the same editor Pine uses.
rm file Delete (remove) the specified file. You will be asked to confirm deletion. Respond yes <y> to delete the file.

WARNING: The rm command permanently erases the specified file. Although regular backups are made, we cannot guarantee that your files can be restored in all cases. For further information, send mail to help@pegasus.cc.ucf.edu or call the E-Mail and Internet Help Desk at 823-6207.

Getting Some Help

man command Display help for the specified command (<SPACEBAR>to go forward, <Q>to quit).

FINDING OUT WHO'S LOGGED ON

To find out who is logged on to the mail server, use the finger command as follows:

pegasus% finger

Sample output is shown below:


Login       Name             TTY Idle    When    Where


msnow    Marilyn Snow        p0      Fri 09:54  132.170.224.45
anderson Eric Anderson       p2      Fri 08:27  kitaro.cc.ucf.edu
scott    Scott Thayer        p4      Fri 10:43  132.170.205.25


The finger command can also return more detailed information about a specific user, as follows:

pegasus% finger user

where user can be a user's first name, last name, or userid. Sample output is shown below:


Login name: anderson                  In real life: Eric Anderson
Directory: /home/pegasus/staff/anderson
 Shell: /bin/csh

On since Sep 10 08:27:00 on ttyp2 from kitaro.cc.ucf.edu
8 minutes 32 seconds Idle Time New mail received Fri Sep 10 10:55:07 1993; unread since Fri Sep 10 08:38:33 1993 Plan: All that we see or seem is but a dream within a dream...

Further information on the finger command can be found by typing man finger at the pegasus prompt.

Creating a Plan File

If you look at the example for fingering a specific user (above) you will see an entry called Plan:. To create a plan file, use the pico editor (the same editor that PINE uses) as follows:

pegasus% pico .plan

Don't forget the dot before plan. Once the editor comes up, type in anything you like. When you are finished, use the exit command (<CONTROL>-<X>) to save your file and leave the editor. Now to make sure everyone can read your file, issue the following command:

pegasus% chmod go+r .plan

For more details on the chmod command, see "Unix File Security (File Permissions)"on page 105.

UNIX FILE SECURITY (FILE PERMISSIONS)

Your files on the mail server are protected through what is known as "file permissions". These file permissions are one or more of the following:

r Read permission. The file can be read from.
w Write premission. The file can be written to.
x Execute permission. The file is a program or shell script that can be executed

These permissions are arranged in the order read, write, and execute (rwx) in groups of three, designating whether the following people have access rights to your files:

user Your access rights to the file.
group Access rights for members of your gorup (e.g. class mates).
other Access rights for anyone else on the system.


drwxr--r--  2 anderson      512 Sep 21 14:00 bin
-rw-------  1 anderson      438 Aug  5 10:03 dream.sig
drwx------  2 anderson      512 Oct 11 16:53 mail
-rw-------  1 anderson      438 Aug  5 10:03 propag.sig
-rwx------  1 anderson       39 Sep 10 16:10 vacation

You will notice that the leftmost column of the listing contains the file permissions. Lets analyze the permissions listing a little more closely:

drwxr--r--

The first position will contain a d if this is a directory. The next three positions are the owner's permissions, the next three the group's permissions, and the last three everyone else's permissions. If there is a dash (-) in a position, it means that a particular permission is denied. For example in the above entry we can see that it is a directory, that the owner has full rights to it, and the group and everyone else has read-only access.

To change your permissions, use the chmod command as follows:

pegasus% chmod who[+/-]permissions filename

where who is u for owner (user), g for group, o for everyone else (other), or a for all three (user, group, and other). These can be combined. permissions is the file permissions (r,w,or x, or a combination of the three) as discussed above, and filename is the file or directory to change permissions for. As an example, suppose we want to grant everyone read access to a file named neat.stuff:

pegasus% chmod o+r neat.stuff

Now suppose we want to deny everyone read and write access to a file named private.stuff:

pegasus% chmod go-rw private.stuff

You can also change your default permissions. Your default permissions is the set of permissions that is automatically assigned to any new file that you create (either directly or by any program that you run). To see what your current default permissions are, use the umask command:

pegasus% umask

When you type the above command you will note that a number is displayed. This number is the octal representation of the rwx set for owner, group, and other users. For example, the default mask for most users is 77 (in reality it should be 077, but the leading zero is often dropped) which means that you have read, write, and execute permissions and all others have no permissions.

Now what do these numbers mean? Each number represents permissions that a particular class of users should not have, and is the sum of the following:

4 read (r) permission
2 write (w) permission
1 execute (x) permission

For example, to deny write and execute permissions, you would add 2 and 1 together to get 3. To deny all permissions: 4 + 2 + 1 = 7, which is the default permission as mentioned in the previous paragraph. A value of 0 means that no permissions have been denied.

Now how to use these numbers? You use the umask command again:

pegasus% umask value

where value is the set of three numbers describing what permissions to deny to owner, group, and other. For example, suppose by default we want to grant the owner all permissions, but allow group and other to have only read permission for any file that is created:

pegasus% umask 033

The first value is 0 since we are not denying the owner any permissions. The second and third numbers are 3 since we are denying group and other write (2) and execute (1) permissions (2 + 1 = 3).

WARNING: Be very careful when you change your default permissions so as not to accidentally grant everyone write access to any file that you create.

AUTOMATICALLY EXECUTING COMMANDS WHEN LOGGING ON

This section is for experienced UNIX users only.

If you are an experienced UNIX user and you wish to set up commands that are automatically executed when you log on, please place the commands in a separate file named .localrc (this file will be called from the .cshrc file). Systems maintenance procedures may require replacing all users' .login and .cshrc files from time to time.